using System;

using System.Xml;

using System.Data;
using Aulac.Global.Enums; using Aulac.Global.Data; using Aulac.Global.Common; using Aulac.Global.Xml;
using System.Windows.Forms;
using Aulac.Client.Connect.Ems;
using System.Collections.Generic;
using Aulac.Client.Data.Helper;
using Aulac.Verb.Ems;
using Aulac.Rsc.Bss;
using Aulac.Rsc.Bss.Tags;

namespace Aulac.Client.Data.Bss.Helper.DataItems
{
	/// <summary>
	/// Summary description for DataCommon.
	/// </summary>
    public class DataPsnHelper
	{
        public static void LoadDataPsnFromSrv(Control ctr, PsnTypes pPsnTypeID, bool pIsActive)
        {
            try
            {
                List<PsnTypes> list = new List<PsnTypes>();
                list.Add(pPsnTypeID);
                LoadDataPsnFromSrv(ctr, list, pIsActive);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static void LoadDataPsnFromSrv(Control ctr, string pPsnPrkID)
        {
            try
            {

                //XmlDataDocument doc = DataRequest.CreateXmlDocument(AulacEmsVerb.Items.PsnItems.GetListPsnItems, AulacEmsVerb.Items.Noun.MdnItems.MdnItem);
                //XmlProcess.AddValueParamItem(doc, tagItems.Psn.PsnPrkID, pPsnPrkID);
                //DataHelper.GetDataFromServerToControl(ctr, doc);

                //Client.Data.XmlQuery.ClientExecXmlQueryDataCatalog query = new Client.Data.XmlQuery.ClientExecXmlQueryDataCatalog(QueryCmdTypes.SelectData);
                //query.SetRequestInfo(Aulac.Verb.AulacVerb.DataQuery.QueryData, Aulac.Verb.AulacVerb.DataQuery.Noun.AulacDataQuery);
                //query.SetVchLinesElm();
                //query.ObjQueryVchLines.TableName = TableNames.Dm_Personnels;
                //query.ObjQueryVchLines.AddFieldNameResultItemRange(
                //    tagItems.Psn.PsnPrkID, tagItems.Psn.PsnName, tagItems.Psn.PsnID, tagItems.Psn.PsnTypeID);

                //query.ObjQueryVchLines.AddValueParamFilterItem(tagItems.Psn.PsnPrkID, tagItems.Psn.PsnPrkID, DbType.Int32, pPsnPrkID);

                //XmlDataDocument xmlDoc = query.ExecureQueryData();
                //DataHelper.LoadDataFromXmlCatalogToControl(ctr, xmlDoc);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static void LoadDataPsnFromSrv(Control ctr, List<PsnTypes> pListPsnTypes, bool pIsActive)
        {
            try
            {
                XmlDataDocument doc = DataRequest.CreateXmlDocument(AulacEmsVerb.Items.PsnItems.GetListPsnItems, AulacEmsVerb.Items.Noun.MdnItems.MdnItem);
                XmlProcess.AddValueParamItem(doc, tagGeneral.IsActive, pIsActive);
                //XmlProcess.AddValueParamItem(doc, tagItems.Psn.CollectionPsnType, StringHelper.ConvertArrayToString(",", pListPsnTypes));
                DataHelper.GetDataFromServerToControl(ctr, doc);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

	}
}
